package com.ymatou.iapi.godmch.testcase;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.common.collect.Lists;
import com.ymatou.iapi.godmch.parameter.setAgentConditionMarkupConfigBean;
import com.ymatou.iapi.godmch.parameter.updateAgentConditionMarkupConfigBean;
import com.ymatou.iapi.godmch.service.updateAgentConditionMarkupConfigCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.godmch.markup_config_agent_price;
import com.ymttest.database.model.godmch.markup_config_agent_priceExample;
import com.ymttest.database.model.godmch.markup_config_condition;
import com.ymttest.database.sqlwapper.godmch.markup_config_agent_priceWapper;
import com.ymttest.database.sqlwapper.godmch.markup_config_agent_priceWapper;
import com.ymttest.utils.TestDataManager;
/**
*修改代理价按条件加价规则
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_updateAgentConditionMarkupConfig{
	private static updateAgentConditionMarkupConfigBean bean;
	private static updateAgentConditionMarkupConfigCall call;
	markup_config_agent_priceWapper priceWapper=new markup_config_agent_priceWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("修改代理价按条件加价规则");
	}

	@Before
	public void caseUp() {
		bean=new updateAgentConditionMarkupConfigBean();
		call=new updateAgentConditionMarkupConfigCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	private markup_config_agent_price selectConfig(Integer mchId,Integer... markupId) throws InterruptedException
	{
		markup_config_agent_priceWapper markupConfig=new markup_config_agent_priceWapper();
		markup_config_agent_priceExample example=new markup_config_agent_priceExample();
		example.createCriteria().andMch_idEqualTo(mchId);
		if(markupId.length>0)
			example.createCriteria().andMarkup_idEqualTo(markupId[0]);
		
		example.setOrderByClause(" create_time desc");
		markup_config_agent_price config=markupConfig.selectByExample(example).get(0);
		return config;
	}
	
	
	private void updateTimeConfig(Integer mchId) throws InterruptedException
	{
		   //修改update_time 因为相同的agentid+suppelierId 1分钟内无法修改
		   markup_config_agent_priceWapper markupConfig=new markup_config_agent_priceWapper();
		   markup_config_agent_priceExample example=new markup_config_agent_priceExample();
		   example.createCriteria().andMch_idEqualTo(mchId);
		   markup_config_agent_price config=markupConfig.selectByExample(example).get(0);
		   config.setUpdate_time(Date.from((LocalDateTime.now().plusDays(-1).atZone(ZoneId.systemDefault()).toInstant())));
		   markupConfig.updateByPrimaryKey(config);
	}
	
	
	 /**
     * 校验数据库
     * @param Condition_type
     * @param lstStr
     * @throws InterruptedException
     */
	private void check_verify(Integer Condition_type,String lstStr) throws InterruptedException {
		
		markup_config_agent_price config=selectConfig(bean.getMchId(),bean.getMarkupId());
		
		Logger.verifyEquals("200", call.getStatusCode1(), "验证status");
		Logger.verifyEquals(Condition_type, config.getCondition_type(), "验证数据库markup_config_agent_price表中的Condition_type字段与传入的一致");
		//Logger.verifyEquals(bean.getMarkupType(), config.getMarkup_type(), "验证数据库markup_config_agent_price表中的Markup_type字段与传入的一致");
		//Logger.verifyEquals(bean.getPercentage().stripTrailingZeros().toPlainString(), config.getPercentage().stripTrailingZeros().toPlainString(), "验证数据库markup_config_agent_price表中的Percentage字段与传入的一致");
		Logger.verifyEquals(bean.getDecimalType(), config.getDecimal_type(), "验证数据库markup_config_agent_price表中的Decimal_type字段与传入的一致");
		
		//Logger.verifyEquals(bean.getOnSaleType(), config.getOn_sale_type(), "验证数据库markup_config_agent_price表中的On_sale_type字段与传入的一致");
		Logger.verifyEquals(bean.getRefreshProduct(), config.getRefresh_product(), "验证数据库markup_config_agent_price表中的Refresh_product字段与传入的一致");
		Logger.verifyEquals(0, config.getConfig_status(), "验证数据库markup_config_agent_price表中的Config_status字段与传入的一致");
		Logger.verifyEquals(lstStr, config.getCondition_list(), "验证数据库markup_config_agent_price表中的Condition_list字段与传入的一致");
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_001() {
		Logger.start(true,"修改代理价按条件加价规则-有变化-发通知");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			Logger.comment("####################  5");
			
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        Logger.comment("####################  6");
	        
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           
		   //品牌
		   bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));

		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_002() {
		Logger.start(true,"修改代理价按条件加价规则-无变化-不发通知");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		   //品牌
		   bean.setBrandList(setBean.getBrandList());

		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_003() {
		Logger.start(true,"修改代理价按条件加价规则-品牌没重复-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			//setBean.setBrandList(null);
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
   	       bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));

		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"]}";
			check_verify(5,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_004() {
		Logger.start(true,"修改代理价按条件加价规则-分类没重复-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setBrandList(null);
		   bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));

		   call.setData(bean);
		   call.callService();			
			
			String str="{\"category\":["+bean.getCategoryList().get(0)+"]}";
			check_verify(6,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_005() {
		Logger.start(true,"修改代理价按条件加价规则-仓库没重复-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setBrandList(null);
           bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));

		   call.setData(bean);
		   call.callService();			
			
		  String str="{\"depot\":["+bean.getDepotList().get(0)+"]}";
		  check_verify(7,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_006() {
		Logger.start(true,"修改代理价按条件加价规则-仓库+分类都不存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setBrandList(null);
		   bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		   bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));

		   call.setData(bean);
		   call.callService();			
			
		   String str="{\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
		   check_verify(4,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_007() {
		Logger.start(true,"修改代理价按条件加价规则-仓库+分类,仓库不存在,分类存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
	        setBean.setBrandList(null);
	        setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
	        setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setBrandList(null);
		   bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));

		   call.setData(bean);
		   call.callService();			
			
		   String str="{\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+setBean.getDepotList().get(0)+"]}"; 
		   check_verify(4,str);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_008() {
		Logger.start(true,"修改代理价按条件加价规则-仓库+品牌都不存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            setBean.setBrandList(null);
            setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
            setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);

		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(3,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_009() {
		Logger.start(true,"修改代理价按条件加价规则-仓库+品牌,仓库存在,品牌不存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            setBean.setBrandList(null);
            setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
            setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));

		   call.setData(bean);
		   call.callService();			
			
		   String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
		   check_verify(3,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_010() {
		Logger.start(true,"修改代理价按条件加价规则-仓库+品牌,仓库不存在,品牌存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            setBean.setBrandList(null);
            setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
            setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));

		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(3,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_011() {
		Logger.start(true,"修改代理价按条件加价规则-仓库+品牌都存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            setBean.setBrandList(null);
            setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
            setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);

		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(3,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_012() {
		Logger.start(true,"修改代理价按条件加价规则-分类+品牌都不存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
		       setBean.setBrandList(null);
	           setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
	           setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);

		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"]}"; 
			check_verify(2,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_013() {
		Logger.start(true,"修改代理价按条件加价规则-分类+品牌,分类存在,品牌不存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
		       setBean.setBrandList(null);
	           setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
	           setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
		 String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"]}"; 
		 check_verify(2,str);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_014() {
		Logger.start(true,"修改代理价按条件加价规则-分类+品牌,分类不存在,品牌存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
		       setBean.setBrandList(null);
	           setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
	           setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
		   String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"]}"; 
			check_verify(2,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_015() {
		Logger.start(true,"修改代理价按条件加价规则-分类+品牌都存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			//setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
		   String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"]}"; 
			check_verify(2,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_016() {
		Logger.start(true,"修改代理价按条件加价规则-品牌+分类+仓库都不存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_017() {
		Logger.start(true,"修改代理价按条件加价规则-品牌+分类+仓库,品牌分类不存在,仓库存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		  //  bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_018() {
		Logger.start(true,"修改代理价按条件加价规则-品牌+分类+仓库,分类仓库不存在,品牌存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		  //  bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_019() {
		Logger.start(true,"修改代理价按条件加价规则-品牌+分类+仓库,分类品牌不存在,仓库存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		    bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		   // bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_020() {
		Logger.start(true,"修改代理价按条件加价规则-品牌+分类+仓库,品牌不存在,分类仓库存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		   // bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_021() {
		Logger.start(true,"修改代理价按条件加价规则-品牌+分类+仓库,仓库不存在,分类品牌存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		   // bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		   // bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_022() {
		Logger.start(true,"修改代理价按条件加价规则-品牌+分类+仓库,分类不存在,仓库品牌存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		    //bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		    bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		   // bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_023() {
		Logger.start(true,"修改代理价按条件加价规则-品牌+分类+仓库,分类仓库品牌都存在-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
		    //bean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		   // bean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
		   // bean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
           
		   call.setData(bean);
		   call.callService();			
			
			String str="{\"brand\":["+bean.getBrandList().get(0)+"],\"category\":["+bean.getCategoryList().get(0)+"],\"depot\":["+bean.getDepotList().get(0)+"]}"; 
			check_verify(1,str);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_024() {
		Logger.start(true,"修改代理价按条件加价规则-加价后小数点类型2保留小数点后1位-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setDecimalType(1);
		   call.setData(bean);
		   call.callService();			
			
		    config=selectConfig(bean.getMchId());
			Logger.verifyEquals(1, config.getDecimal_type(), "验证数据库markup_config_condition表中的Decimal_type字段与传入的一致");					
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_025() {
		Logger.start(true,"修改代理价按条件加价规则-加价后小数点类型3保留小数点后2位变为 2：保留小数点后1位-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
			setBean.setBrandList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setCategoryList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			setBean.setDepotList(Lists.newArrayList(Integer.parseInt(TestDataManager.getRandomNum(5))));
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setDecimalType(1);
		   call.setData(bean);
		   call.callService();			
			
		    config=selectConfig(bean.getMchId());
			Logger.verifyEquals(1, config.getDecimal_type(), "验证数据库markup_config_condition表中的Decimal_type字段与传入的一致");					
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_026() {
		Logger.start(true,"修改代理价按条件加价规则-不覆盖 变为 覆盖已添加的商品价格-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setRefreshProduct(false);
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setRefreshProduct(true);
		   call.setData(bean);
		   call.callService();			
			
		    config=selectConfig(bean.getMchId());
			Logger.verifyEquals(true, config.getRefresh_product(), "验证数据库markup_config_condition表中的Refresh_product字段与传入的一致");						
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_updateAgentConditionMarkupConfig_027() {
		Logger.start(true,"修改代理价按条件加价规则-覆盖 变为 不覆盖 已添加的商品价格-返回成功");
		try {
			setAgentConditionMarkupConfigBean setBean=GodmchManageCallService.initSetAgentConditionMarkupConfig();
            bean.setRefreshProduct(true);
			GodmchManageCallService.setAgentConditionMarkupConfigCall(setBean);
			//修改时间
	        updateTimeConfig(setBean.getMchId());
	        markup_config_agent_price config=selectConfig(setBean.getMchId());
           //修改
           bean=GodmchManageCallService.initUpdateAgentConditionMarkupConfig(setBean.getMchId(),config.getMarkup_id(),setBean);
           bean.setRefreshProduct(false);
		   call.setData(bean);
		   call.callService();			
			
		    config=selectConfig(bean.getMchId());
			Logger.verifyEquals(false, config.getRefresh_product(), "验证数据库markup_config_condition表中的Refresh_product字段与传入的一致");							
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}